package zhoug.demo.chart2;

import zhoug.common.interfaces.NameTransformer;

import java.util.Objects;
import java.util.UUID;

/**
 * @Author: zhoug
 * @Date: 2024-07-11
 * @Description:
 */
public class Area extends BaseBean  implements NameTransformer {
    private String code;
    private String name;

    public Area(String name, String code) {
        this.name = name;
        this.code = code;
    }

    public Area(String name) {
        this.name = name;
        this.code= UUID.randomUUID().toString();
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String transformName() {
        return name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Area area = (Area) o;
        return Objects.equals(code, area.code) && Objects.equals(name, area.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(code, name);
    }
}
